package com.strato.jdbc.datasource.v1_0_0.activator;

import java.util.HashMap;
import java.util.Map;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

import com.strato.base.osgi.v1_0_0.BundleUtil;
import com.strato.jdbc.datasource.v1_0_0.DataSourceFactory;
import com.strato.jdbc.datasource.v1_0_0.DefaultDataSourceFactory;

public class Activator implements BundleActivator {

	private static BundleContext bundleContext;
	
	@Override
	public void start(BundleContext context) throws Exception {
		{
			DataSourceFactory dsf=new DefaultDataSourceFactory();
			Map<String, Object> props=new HashMap<String, Object>();
			props.put("id", "defaultDataSourceFactory");
			BundleUtil.exportServices(context, dsf, null, props);
		}
		bundleContext=context;
	}

	@Override
	public void stop(BundleContext context) throws Exception {
		bundleContext=null;
	}

	public static BundleContext getContext(){
		return bundleContext;
	}
}
